#include "GraphicalEntity.h"
#include "PhysicsObjects.h"
#include "Bolt.h"
#pragma once

class _RailGun : public BaseIndexedGraphicalEntity
{
private:
	D3DXMATRIX WVPMat;
	Entity *Parent;
	D3DXVECTOR3 Offset;
	PhysicsBox BoundingBox;
	UINT MaximumBolts;
	D3DXVECTOR3 Angles;
	float Time, LastFireTime;
	UINT NextBolt;

	ID3DXEffect *Effect;

protected:

public:
	std::vector<RailBolt*> Bolts;

	_RailGun();
	_RailGun(IDirect3DDevice9 *nDevice, int MaxBolts, D3DXVECTOR3 nOffset, ID3DXEffect *nEffect);
	~_RailGun();

	void SetParent( Entity *nParent );
	void SetOffset( D3DXVECTOR3 nOffset );
	D3DXVECTOR3 GetOffset( void );

	virtual void Update(float dt);
	virtual void Render( void );

	void SetWVPMat( D3DXMATRIX nWVPMat );
	void SetAngles(D3DXVECTOR3 nAngles);
	D3DXVECTOR3 GetAngles( void );

	void Fire( void );

	void Reload( void );
	
};